Twitter (X)のThreadのURLをまとめてコピーするbookmarklet
code:html
<a href="/wasedamental/status/1694527775653445863" aria-describedby="id__3mbl2s6rh3t" aria-label="午前10:51 · 2023年8月24日" role="link" class="css-4rbku5 css-18t94o4 css-901oao css-16my406 r-1bwzh9t r-1loqt21 r-xoduu5 r-1q142lx r-1w6e6rj r-1tl8opc r-9aw3ui r-bcqeeo r-3s2u2q r-qvutc0"><time datetime="2023-08-24T01:51:19.000Z">午前10:51 · 2023年8月24日</time></a>
<a href="/wasedamental/status/1694528071821668442" dir="ltr" aria-label="15 時間前" role="link" class="css-4rbku5 css-18t94o4 css-901oao r-1bwzh9t r-1loqt21 r-xoduu5 r-1q142lx r-1w6e6rj r-1tl8opc r-a023e6 r-16dba41 r-9aw3ui r-rjixqe r-bcqeeo r-3s2u2q r-qvutc0"><time datetime="2023-08-24T01:52:29.000Z">15時間</time></a>
code:js
const urls = [];
const times = document.querySelectorAll('time');
const getUser = url => new URL(url).pathname.split('/')1;
const tweetUser = getUser(times0.parentNode.href);
for (let time of times) {
let url = time.parentNode.href;
if (typeof url === "undefined" || getUser(url) != tweetUser) {
break;
} else {
urls.push(url);
}
}
// Copy to clipboard (need to focus on the page)
await navigator.clipboard.writeText(urls.join('\n'));
code:bookmarklet
javascript:(async function(){const e=[],t=document.querySelectorAll('time'),n=url=>new URL(url).pathname.split('/')1,r=n(t0.parentNode.href);for(let o of t){let t=o.parentNode.href;if(n(t)!=r)break;e.push(t)}await navigator.clipboard.writeText(e.join('\n'))})();